<template>
  <div class="appheader">
      <van-nav-bar
      :title="title"
      />
  </div>
</template>

<script>
import Vue from 'vue'
import { NavBar, Icon } from 'vant'

Vue.use(NavBar)
Vue.use(Icon)

export default {
  name: 'appheader',
  data () {
    return {
      title: ''
    }
  },
  watch: {
    $route: {
      handler: function (newRoute) {
        this.title = newRoute.meta && newRoute.meta.title
      },
      immediate: true
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
